/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package yudisium;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

/**
 *
 * @author Antonius
 */
public class UntukBuatTabelQuery {
     public static void main(String[] args) {
        String jdbcUrl = "jdbc:oracle:thin:@localhost:1522:xe";
        String userid = "HR"; // gantikan dengan username anda
        String password = "dyah"; // gantikan dengan password anda
//        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
//        String userid = "MHS115314090"; // gantikan dengan username anda
//        String password = "MHS115314090"; // gantikan dengan password anda
        Connection conn;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(userid, password);
            Statement statement = conn.createStatement();
            System.out.println("Koneksi is OK");

            String sql = " CREATE table YUDISIUM "
                    + "(nim VARCHAR2   (50) NOT NULL,"
                    + " nama VARCHAR2(100) NOT NULL,"
                    + " prodi VARCHAR2(100) NOT NULL,"
                    + " nmrHp VARCHAR2(100) NOT NULL,"
                    + " perYudtgl VARCHAR2(100) NOT NULL,"
                    + " perYudbln VARCHAR2(100) NOT NULL,"
                    + " perYudthn VARCHAR2(100) NOT NULL,"
                    + " daftarNilai VARCHAR2(100) NOT NULL,"
                    + " naskahTA VARCHAR2(100) NOT NULL,"
                    + " bebasLab VARCHAR2(100) NOT NULL,"
                    + " bebasDos VARCHAR2 (100) NOT NULL,"
                    + " buktiLapKP VARCHAR2(200) NOT NULL,"
                    + " suratKKL VARCHAR2(200) NOT NULL,"
                    + " fileSuratket VARCHAR2(200) NOT NULL,"
                    + "constraint YUDISIUM_PK primary key (nim)ENABLE)";
            statement.executeUpdate(sql);
            
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
